#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
void fun(char* p, int len, int n)
{
	int left = 0;
	int right = len - 1;
	while (left < right)
	{
		int tmp = 0;
		tmp = *(p + left);
		*(p + left) = *(p + right);
		*(p + right) = tmp;
		left++;
		right--;
	}
	left = 0;
	right = len - 1 - n;
	while (left < right)
	{
		int tmp = 0;
		tmp = *(p + left);
		*(p + left) = *(p + right);
		*(p + right) = tmp;
		left++;
		right--;
	}
	left = len - n;
	right = len - 1;
	while (left < right)
	{
		int tmp = 0;
		tmp = *(p + left);
		*(p + left) = *(p + right);
		*(p + right) = tmp;
		left++;
		right--;
	}
	int i = 0;
	for (i = 0; i < len; i++)
	{
		printf("%c", *(p++));
	}
}
int main()
{
	char arr[] = "ABCDEFG";
	int len = strlen(arr);
	int n = 0;
	scanf("%d", &n);
	fun(arr, len, n);
	return 0;
}